<!--弹窗部分 begin-->
<div id="shareAllBox" style="display:none;">
  <div class="participation_box">
    <ul class="tab">
      <li class="on"><span href="javascript:void(0)" onClick="popBox('shareAllBox')">{:L('share_all_colleague')}</span></li>
      <li><span href="javascript:void(0)" onClick="popBox('sharePartBox')">{:L('share_to_colleague')}</span></li>            
      <li><span href="javascript:void(0)" onClick="popBox('collect')">{:L('share_collection')}</span></li>
    </ul>
    <dl>
      <dt>{:L('share_content')}</dt>
      <dd style="padding:0 30px;"><a href="{$url}">{$title}</a></dd>
    </dl>
    <dl>
      <dt>{:L('share_add_content')}</dt>
      <dd><textarea class="in_put" id="info_shareAllBox" style="width:97%;"></textarea></dd>
    </dl>

  </div>
</div>
<div id="sharePartBox" style="display:none;">
  <div class="participation_box">
    <ul class="tab">
      <li><span href="javascript:void(0)" onClick="popBox('shareAllBox')">{:L('share_all_colleague')}</span></li>
      <li class="on"><span href="javascript:void(0)" onClick="popBox('sharePartBox')">{:L('share_to_colleague')}</span></li>            
      <li><span href="javascript:void(0)" onClick="popBox('collect')">{:L('share_collection')}</span></li>
    </ul>
    <dl>
      <dt>{:L('share_content')}</dt>
      <dd style="padding:0 30px;"><a href="{$url}">{$title}</a></dd>
    </dl>    
    <dl>
      <dt>{:L('share_colleague')}</dt>
      <dd style="padding:0 30px;">{:W('SearchUsers',array('name'=>'fids'))}</dd>
    </dl>
    <dl>
      <dt>{:L('share_add_content')}：</dt>
      <dd><textarea id="info_sharePartBox" style="width:100%;"></textarea></dd>
    </dl>
  </div>
</div>


<div id="collect" style="display:none;">
  <div class="participation_box">
    <ul class="tab">
      <li><span href="javascript:void(0)" onClick="popBox('shareAllBox')">{:L('share_all_colleague')}</span></li>
      <li><span href="javascript:void(0)" onClick="popBox('sharePartBox')">{:L('share_to_colleague')}</span></li>            
      <li class="on"><span href="javascript:void(0)" onClick="popBox('collect')">{:L('share_collection')}</span></li>
    </ul>
    <dl>
      <dt>{:L('share_collection_content')}</dt>
      <dd style="padding:0 30px;"><a href="{$url}">{$title}</a></dd>
    </dl>
    <dl>
      <dt>{:L('share_add_content')}</dt>
      <dd><textarea class="in_put" id="info_collect" style="width:97%;"></textarea></dd>
    </dl>
  </div>
</div>

<!--===============按钮部分 begin================-->
<div class="useraction"> <a href="javascript:void(0)" onClick="popBox('collect')">{:L('share_collection')}</a> <a class="share" href="javascript:void(0)" onClick="popBox('shareAllBox')">{:L('share_title')}</a> <a href="javascript:void(0)" class="look" rel="{$aimId}" title="{:L('share_nice')}"> <span> {$digCount} </span> </a> <span class="clew" id="dig{$aimId}"> </span> </div>
<!--按钮部分 begin-->

<script language="javascript" type="text/javascript">
var tag  = '';
var fids = '';
var type = 'sharePartBox';
var html = new Array();
var appendUrl = '{$append}';
var info = '';

$(function(){
   $('.look').click(function(){
	  var _this = $(this);
	  var blogId = $(this).attr('rel');
	  var old_count = _this.children('span').html();
	  var url = URL+"&act=userDig";
	  if(appendUrl != ''){
		  url += "&"+appendUrl;
	  }
	 $.post(url,{blogId:blogId},function(text){
		   if(text == 1){
				  old_count = parseInt(old_count);
				  old_count = old_count + 1;
			  _this.children('span').html(old_count);
				  
			  
				  var html = $('#dig'+blogId);
					  html.html("{:L('share_my_dig')}");
					  setTimeout("hideDigResult("+blogId+")",1000);
				  
	  
		   }else{
					var html = $('#dig'+blogId);
					   html.addClass('cl04');
						  html.html(text);
						  setTimeout("hideDigResult("+blogId+")",1000);
						  return true;
		   }

		   });
	 });
})

function hideDigResult(blogId){
	var html = $('#dig'+blogId);
	html.html("");
}
function doAddShare(){
	info = $('#info_'+type).val();	
	var fids = $("#ts_search_value").val();
	
	var title = "{$title}";
	var intro = "{$intro}";
	var fromUid = '{$fromUid}';
	var aimId = '{$aimId}';
	var temp = '{$temp}';
	var data = "{$data}";
	
	if(type=='shareAllBox') var typeId = 0;
	else if(type=='sharePartBox') var typeId = 1;
	else var typeId = 2;

	$.post(
		   "{:U('home/share/doAddShare')}",
		   {info:info,type:typeId,title:title,intro:intro,fromUid:fromUid,aimId:aimId,temp:temp,fids:fids,data:data},
		   function(txt){
			  if(txt==0){
				  $.tbox.no(tag+'{:L('share_tag_error')}');					
			  }else if(txt==-1){
				  $.tbox.no('{:L('share_already')}'+tag+',{:L('share_not_repeat')}'+tag);
			  }else{
				  $.tbox.yes(tag+'{:L('share_tag_success')}');				  
			  }
			  setTimeout('$.tbox.close()',1500);
	});	
}

function popBox(id){	
    type = id;
	
	$("textarea[id*='info_']").each(function(i,n){
	    var infoVal = $(this).val();
		if(typeof(infoVal)!='undefined'||infoVal!=''){
			info = infoVal;
		}
	});

	if(typeof(html[id])=='undefined'||html[id]==''){
		html[id] = $('#'+id).html();
		if(info!=''||typeof(info=='undefined')){
			html[id] = html[id].replace('</textarea>', info+'</textarea>');
		}
		$('#'+id).html('');
	}else{
		html[id] = html[id].replace('></textarea>', '>'+info+'</textarea>');
	}
	
	if(id=='collect') tag = '{:L('share_collection')}';
	else              tag = '{:L('share_title')}';
			
	$.tbox.popBox(html[id],tag,{ok:"doAddShare"});
}
</script>